package interfacePackage;

import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.Rectangle;
import java.awt.Color;
import javax.swing.JTable;
import interfacePackageStructures.MyTableVillesIntermediaires;
import javax.swing.BorderFactory;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.JTabbedPane;

import pathFinderPackage.Itineraire;
import edu.uci.ics.jung.visualization.VisualizationViewer;
import jungPackage.JUNGCarte;

public class PanelItineraireAffichageToutesEtapes extends JPanel {

	private static final long serialVersionUID = 1L;
	private MyTableVillesIntermediaires myTableEtapesCourante = null;
	private JTabbedPane jTabbedPane = null;
	private JScrollPane jScrollPaneEtapes = null;
	private JTable jTableEtapes = null;
	private VisualizationViewer jPanelGraphe = null;
	private JUNGCarte jungCarte = null;
	private Itineraire m_itineraire;

	/**
	 * This is the default constructor
	 */
	public PanelItineraireAffichageToutesEtapes() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.setSize(710, 230);
		this.setLayout(null);
	}

	/**
	 * This method initializes myTableEtapesCourante	
	 * 	
	 * @return interfacePackageStructures.MyTableVillesIntermediaires	
	 */
	private MyTableVillesIntermediaires getMyTableEtapesCourante() {
		if (myTableEtapesCourante == null) {
			myTableEtapesCourante = new MyTableVillesIntermediaires();
		}
		return myTableEtapesCourante;
	}
	
	private VisualizationViewer getJPanelGraphe() {
		if (jPanelGraphe == null) {
			jungCarte = new JUNGCarte(m_itineraire, new Dimension(580, 200));
			jPanelGraphe = jungCarte.getJungPanel();
			jPanelGraphe.restart();
			jungCarte.scaleTo(m_itineraire.getVilleDepart());
			//jTabbedPane.getTabComponentAt(0).setVisible(true);
			//jPanelGraphe.setLayout(new GridBagLayout());
		}
		return jPanelGraphe;
	}


	/**
	 * This method initializes jTabbedPane	
	 * 	
	 * @return javax.swing.JTabbedPane	
	 */
	private JTabbedPane getJTabbedPane() {
		if (jTabbedPane == null) {
			jTabbedPane = new JTabbedPane();
			jTabbedPane.setBackground(new java.awt.Color(225, 242, 243));
			//jTabbedPane.setOpaque(true);
			jTabbedPane.addTab("Etapes", null, getJScrollPaneEtapes(), null);
			jTabbedPane.addTab("Graphe", null, getJPanelGraphe(), null);
			jTabbedPane.setBounds(new Rectangle(42, 210, 584, 222));
			jTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {
				public void stateChanged(javax.swing.event.ChangeEvent e) {
					System.out.println("stateChanged()"); // TODO Auto-generated Event stub stateChanged()
					buttonPlus.setVisible(!buttonPlus.isVisible());
					buttonMoins.setVisible(!buttonMoins.isVisible());
				}
			});
		}
		return jTabbedPane;	
	}

	/**
	 * This method initializes jScrollPaneEtapes	
	 * 	
	 * @return javax.swing.JScrollPane	
	 */
	private JScrollPane getJScrollPaneEtapes() {
		if (jScrollPaneEtapes == null) {
			jScrollPaneEtapes = new JScrollPane();
		}
		return jScrollPaneEtapes;
	}

	/**
	 * This method initializes jTableEtapes	
	 * 	
	 * @return javax.swing.JTable	
	 */    
	private JTable getJTableEtapes() {
		if (jTableEtapes == null) {
			jTableEtapes = invalid: "IWAV0177E Expression "myTableEtapes" is too complicated. - new JTable(myTableEtapes)";
		}
		return jTableEtapes;
	}

	/**
	 * This method initializes jungCarte	
	 * 	
	 * @return jungPackage.JUNGCarte	
	 */    
	private JUNGCarte getJungCarte() {
		if (jungCarte == null) {
			jungCarte = invalid: "IWAV0177E Expression "m_itineraire" is too complicated. - new JUNGCarte(m_itineraire,new Dimension(580,200))";
		}
		return jungCarte;
	}

}
